import os
import os.path as osp
from pathlib import Path

from tqdm import tqdm



IMAGE_SUFFIX = [".jpg", ".jpeg", ".png"]


if __name__ == "__main__":
    image_path = "img"
    save_path = "image"
    if not osp.exists(save_path):
        os.makedirs(save_path)
    for img_path in tqdm([str(path) for path in Path(image_path).rglob("*")if path.is_file() and path.suffix in IMAGE_SUFFIX]):
        cmd = f"COPY {img_path} {osp.join(save_path, osp.basename(img_path))}"
        os.system(cmd)